﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using Model;

namespace Interfaces.Tareas
{
    public partial class Reportes : System.Web.UI.Page
    {
        Miembroo directoratarea { get { return (Miembroo)ViewState["directoratarea"]; } set { ViewState["directoratarea"] = value; } }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
                FormsAuthentication.RedirectToLoginPage();
            if (Session["directoratarea"] != null)
            {
                directoratarea = (Miembroo)Session["directoratarea"];
                Label7.Text = directoratarea.Nombre + " " + directoratarea.ApellidoPaterno;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("/Miembro/BuscarMiembro.aspx?Index=" + false + "&VerificarPagina=2");
        }
        protected void Page_PreInit(object sender, EventArgs e)
        {
            if (Session["BuscarMaster"] != null)
            {
                string res = (string)Session["BuscarMaster"];
                this.MasterPageFile = res;
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            if (Session["directoratarea"] != null)
            {
                int gestion=DateTime.Now.Year;
                LabelError.Text = "";
                Chart1.DataSource = Processes.Tareas.GestorTareas.reporte(directoratarea.CI,gestion);           
                Chart1.Series[0].XValueMember = "Nombre";
                Chart1.Series[0].YValueMembers = "Porcentaje";                
                Chart1.DataBind();
                                    
            }
            else
            {
                LabelError.Text = "Debe buscar una miembro";
            }
        }
    }
}